import _objectSpread from '@babel/runtime/helpers/esm/objectSpread2';
import React, { forwardRef } from 'react';
import Form from '../../Form';
import EditableTable from './EditableTable';
import './index.css';
var EditableTableField = function EditableTableField(props, ref) {
  return /*#__PURE__*/ React.createElement(
    Form.Item,
    {
      noStyle: true,
      shouldUpdate: function shouldUpdate(prevVals, currVals) {
        return prevVals[props.name] !== currVals[props.name];
      },
    },
    function (form) {
      var value = form.getFieldValue(props.name);
      return /*#__PURE__*/ React.createElement(
        EditableTable,
        _objectSpread(
          _objectSpread({}, props),
          {},
          {
            value: value,
            ref: ref,
            // @ts-ignore
            form: form,
          },
        ),
      );
    },
  );
};
export default /*#__PURE__*/ forwardRef(EditableTableField);
